package com.taotao.Controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.taotao.common.pojo.EUDataGridResult;
import com.taotao.common.pojo.TaotaoResult;
import com.taotao.pojo.TbItemParam;
import com.taotao.service.ItemParamService;

@Controller
@RequestMapping("/item/param")
public class ItemParamController {
	
	@Autowired
	ItemParamService itemParamService;
	
	@RequestMapping("/query/itemcatid/{cid}")
	@ResponseBody
	public TaotaoResult getItemParamById(@PathVariable long cid) {
		TaotaoResult taotaoResult = itemParamService.getItemParamById(cid);
		return taotaoResult;
	}
	
	@RequestMapping("/list")
	@ResponseBody
	public EUDataGridResult getItemParamList(int page,int rows) {
		EUDataGridResult eud = itemParamService.getItemParamList(page, rows);
		return eud;
	}
	@RequestMapping("/save/{cid}")
	@ResponseBody
	public TaotaoResult saveItemParam(@PathVariable long cid,String paramData) {
		TbItemParam tbItemParam = new TbItemParam();
		tbItemParam.setParamData(paramData);
		tbItemParam.setItemCatId(cid);
		itemParamService.savaItemParam(tbItemParam);
		return TaotaoResult.ok();
	}
	
}
